<ui:component xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
  xmlns:composite="http://java.sun.com/jsf/composite"
  xmlns:p="http://primefaces.org/ui">
  <composite:interface>  
    <composite:attribute name="type"/>
    <composite:attribute name="link"/>
    <composite:attribute name="popup"/>  
  </composite:interface>
  <composite:implementation>   	
  
    <p:growl id="loglog" />
  	<h:panelGroup rendered="#{cc.attrs.type == 'login'}">
	  <p:commandLink id="modalDialogButton" rendered="#{cc.attrs.link == true}" value="#{strings['home.seconnecter']}" onclick="dlg1.show();" type="link" ajax="true"/>
	  <p:dialog id="basicDialog" rendered="#{cc.attrs.popup == true}" header="Connexion" widgetVar="dlg1" modal="true">
	    	<h:form id="loginForm" rendered="#{clientController.loggedIn != true}">  
				<h:panelGrid columns="3">
				     <h:outputLabel styleClass="login-label" for="login" value="#{strings['inscription.login']}" />
				     <p:inputText id="login" value="#{loginForm.login}" required="true" requiredMessage="Connexion: Veuillez saisir un login"/>
				     <h:message for="login"></h:message>
				     
				     <h:outputLabel styleClass="login-label" for="password" value="#{strings['inscription.password']}" />
				     <p:inputText id="password" type="password" value="#{loginForm.password}" required="true" requiredMessage="Connexion: Veuillez saisir un mot de passe"/>
				     <h:message for="password"></h:message>				   		
				 </h:panelGrid> 
				 <p:commandButton styleClass="submit-login" action="#{clientController.doLogin}" value="Se connecter" ajax="false" update="loglog"/>
				 <div class="clearer"></div>
				 <h:messages globalOnly="true"/>		 
			 </h:form>
		</p:dialog>
	</h:panelGroup>
	
	<p:growl id="suscribe2" />
  	<h:panelGroup rendered="#{cc.attrs.type == 'register'}">
	    <p:commandLink id="modal"  rendered="#{cc.attrs.link == true}" value="#{strings['home.inscription']}" onclick="dlg2.show();" type="link" ajax="true"/>
	    <p:dialog id="basicDialog2"  rendered="#{cc.attrs.popup == true}" header="S'inscrire" widgetVar="dlg2" modal="true">
		    <h:form id="contentForm">
		      <p:panelGrid columns="3">
		        <h:outputText value="Login" />
		        <h:inputText id="login" value="#{registerForm.login}" required="true" requiredMessage="Inscription: Veuillez saisir un login" />
		        <h:message for="login"></h:message>
		        
		        <h:outputText value="Mot de passe" />
		        <h:inputText id="password" value="#{registerForm.password}" required="true" requiredMessage="Inscription: Veuillez saisir un mot de passe"/>
		        <h:message for="password"></h:message>
		        
		        <h:outputText value="#{strings['inscription.nom']}" />
		        <h:inputText id="nom" value="#{registerForm.nom}" required="true" requiredMessage="Inscription: Veuillez saisir un nom"/>
		        <h:message for="nom"></h:message>
		        
		         
		        <h:outputText value="#{strings['inscription.prenom']}" />
		        <h:inputText id="prenom" value="#{registerForm.prenom}" required="true" requiredMessage="Inscription: Veuillez saisir un prenom"/>
		        <h:message for="prenom"></h:message>
		        
		        
		        <h:outputText value="#{strings['inscription.adresse']}" />
		        <h:inputText id="adresse" value="#{registerForm.adresse}"  />
		        <h:message for="adresse"></h:message>
		        
		        
		        <h:outputText value="#{strings['inscription.email']}" />
		        <h:inputText id="email" value="#{registerForm.email}" required="true" requiredMessage="Inscription: Veuillez saisir un email"/>
		        <h:message for="email"></h:message>
		        
		        
		        <h:outputText value="#{strings['inscription.telephone']}" />
		        <h:inputText id="telephone" value="#{registerForm.telephone}"  />
		        <h:message for="telephone"></h:message>                                       
		        
		      </p:panelGrid>
		      <h:commandButton action="#{clientController.register}" value="#{strings['inscription.suscribe']}" update="suscribe2"/>
		      <h:messages globalOnly="true"/>
		    </h:form>
		</p:dialog>
  	</h:panelGroup>

   	<h:panelGroup rendered="#{cc.attrs.type == 'paiement'}">
	    <p:commandLink id="paiement"  rendered="#{cc.attrs.link == true}" value="Procéder au paiement" onclick="dlg3.show();" type="link" ajax="true"/>
	    <p:dialog id="basicDialogPaiement"  rendered="#{cc.attrs.popup == true}" header="Procéder au paiement" widgetVar="dlg3" modal="true">
		    <h:form id="paiementForm">
		      <p:panelGrid columns="3">
		      
		        <h:outputLabel for="total" value="Total commande : #{orderController.tempOrder.total} euros "/>
		       
		    	<h:outputText value="Numero de carte bancaire" />
		    	<p:inputText id="numero" value="#{paiementController.paiement.numero}" required="true" />
		    	<h:message for="numero"> </h:message>	  
		    			           	
		    	<h:outputText value="Champs mois" />
		    	<p:inputText id="dateExpirationChamps1" value="#{paiementController.paiement.dateExpirationChamps1}" required="true" />
				<h:message for="dateExpirationChamps1"> </h:message>	
		
		    	<h:outputText value="Champs année" />
		    	<p:inputText id="dateExpirationChamps2" value="#{paiementController.paiement.dateExpirationChamps2}" required="true" />
				<h:message for="dateExpirationChamps2"> </h:message>	
			     	              
		    	<h:outputText value="3 chiffres" />
		    	<p:inputText id="chiffres" value="#{paiementController.paiement.chiffres}" required="true" />
    			<h:message for="chiffres"> </h:message>	
				        
		      <p:commandButton action="#{paiementController.createPaiement}" value="Valider le paiement" onclick="dlgPaiement.show();">
		      	<f:param name="orderId" value="#{orderController.tempOrder.id}"/>
		      </p:commandButton> 

				<p:dialog header="Dialog" widgetVar="dlgPaiement" maximizable="true" minimizable="true">
				    <h:outputText value="Votre paiement a été validé" />
				</p:dialog>	
		   
		      </p:panelGrid>
					<h:messages globalOnly="true"/>
		    </h:form>
		</p:dialog>
  	</h:panelGroup> 
  	
  </composite:implementation>
</ui:component>